﻿<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
  
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Class NtpPacket
   </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Class NtpPacket
   ">
    <meta name="generator" content="docfx 2.58.5.0">
    
    <link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" href="../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../styles/docfx.css">
    <link rel="stylesheet" href="../styles/main.css">
    <meta property="docfx:navrel" content="../toc.html">
    <meta property="docfx:tocrel" content="toc.html">
    
    
    
  </head>
  <body data-spy="scroll" data-target="#affix" data-offset="120">
    <div id="wrapper">
      <header>
        
        <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
          <div class="container">
            <div class="navbar-header">
              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
              
              <a class="navbar-brand" href="../index.html">
                <img id="logo" class="svg" src="../logo.svg" alt="">
              </a>
            </div>
            <div class="collapse navbar-collapse" id="navbar">
              <form class="navbar-form navbar-right" role="search" id="search">
                <div class="form-group">
                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
                </div>
              </form>
            </div>
          </div>
        </nav>
        
        <div class="subnav navbar navbar-default">
          <div class="container hide-when-search" id="breadcrumb">
            <ul class="breadcrumb">
              <li></li>
            </ul>
          </div>
        </div>
      </header>
      <div role="main" class="container body-content hide-when-search">
        
        <div class="sidenav hide-when-search">
          <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
          <div class="sidetoggle collapse" id="sidetoggle">
            <div id="sidetoc"></div>
          </div>
        </div>
        <div class="article row grid-right">
          <div class="col-md-10">
            <article class="content wrap" id="_content" data-uid="LiteNetLib.Utils.NtpPacket">
  
  
  <h1 id="LiteNetLib_Utils_NtpPacket" data-uid="LiteNetLib.Utils.NtpPacket" class="text-break">Class NtpPacket
  </h1>
  <div class="markdown level0 summary"><p>Represents RFC4330 SNTP packet used for communication to and from a network time server.</p>
</div>
  <div class="markdown level0 conceptual"></div>
  <div class="inheritance">
    <h5>Inheritance</h5>
    <div class="level0"><span class="xref">System.Object</span></div>
    <div class="level1"><span class="xref">NtpPacket</span></div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="LiteNetLib.Utils.html">LiteNetLib.Utils</a></h6>
  <h6><strong>Assembly</strong>: LiteNetLib.dll</h6>
  <h5 id="LiteNetLib_Utils_NtpPacket_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public class NtpPacket</code></pre>
  </div>
  <h5 id="LiteNetLib_Utils_NtpPacket_remarks"><strong>Remarks</strong></h5>
  <div class="markdown level0 remarks"><p>
Most applications should just use the <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_CorrectionOffset">CorrectionOffset</a> property.
</p>
<p>
The same data structure represents both request and reply packets.
Request and reply differ in which properties are set and to what values.
</p>
<p>
The only real property is <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_Bytes">Bytes</a>.
All other properties read from and write to the underlying byte array
with the exception of <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_DestinationTimestamp">DestinationTimestamp</a>,
which is not part of the packet on network and it is instead set locally after receiving the packet.
</p>
<p>
Copied from <a href="https://guerrillantp.machinezoo.com/">GuerrillaNtp project</a>
with permission from Robert Vazan (@robertvazan) under MIT license, see <a href="https://github.com/RevenantX/LiteNetLib/pull/236">https://github.com/RevenantX/LiteNetLib/pull/236</a>
</p>
</div>
  <h3 id="constructors">Constructors
  </h3>
  
  
  <a id="LiteNetLib_Utils_NtpPacket__ctor_" data-uid="LiteNetLib.Utils.NtpPacket.#ctor*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket__ctor" data-uid="LiteNetLib.Utils.NtpPacket.#ctor">NtpPacket()</h4>
  <div class="markdown level1 summary"><p>Initializes default request packet.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public NtpPacket()</code></pre>
  </div>
  <h5 id="LiteNetLib_Utils_NtpPacket__ctor_remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>Properties <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_Mode">Mode</a> and <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_VersionNumber">VersionNumber</a>
are set appropriately for request packet. Property <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_TransmitTimestamp">TransmitTimestamp</a>
is set to <span class="xref">System.DateTime.UtcNow</span>.</p>
</div>
  <h3 id="properties">Properties
  </h3>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_Bytes_" data-uid="LiteNetLib.Utils.NtpPacket.Bytes*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_Bytes" data-uid="LiteNetLib.Utils.NtpPacket.Bytes">Bytes</h4>
  <div class="markdown level1 summary"><p>Gets RFC4330-encoded SNTP packet.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public byte[] Bytes { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Byte</span>[]</td>
        <td><p>Byte array containing RFC4330-encoded SNTP packet. It is at least 48 bytes long.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="LiteNetLib_Utils_NtpPacket_Bytes_remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>This is the only real property. All other properties except
<a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_DestinationTimestamp">DestinationTimestamp</a> read from or write to this byte array.</p>
</div>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_CorrectionOffset_" data-uid="LiteNetLib.Utils.NtpPacket.CorrectionOffset*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_CorrectionOffset" data-uid="LiteNetLib.Utils.NtpPacket.CorrectionOffset">CorrectionOffset</h4>
  <div class="markdown level1 summary"><p>Gets the offset that should be added to local time to synchronize it with server time.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public TimeSpan CorrectionOffset { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.TimeSpan</span></td>
        <td><p>Time difference between server and client. It should be added to local time to get server time.
It is calculated from timestamps in the packet as <code>0.5 * ((t1 - t0) - (t3 - t2))</code>
where t0 is <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_OriginTimestamp">OriginTimestamp</a>,
t1 is <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_ReceiveTimestamp">ReceiveTimestamp</a>,
t2 is <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_TransmitTimestamp">TransmitTimestamp</a>,
and t3 is <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_DestinationTimestamp">DestinationTimestamp</a>.
This property throws an exception in request packets.</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_DestinationTimestamp_" data-uid="LiteNetLib.Utils.NtpPacket.DestinationTimestamp*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_DestinationTimestamp" data-uid="LiteNetLib.Utils.NtpPacket.DestinationTimestamp">DestinationTimestamp</h4>
  <div class="markdown level1 summary"><p>Gets or sets the time of reception of response SNTP packet on the client.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public DateTime? DestinationTimestamp { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Nullable</span>&lt;<span class="xref">System.DateTime</span>&gt;</td>
        <td><p>Time of reception of response SNTP packet on the client. It is <code>null</code> in request packets.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="LiteNetLib_Utils_NtpPacket_DestinationTimestamp_remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>This property is not part of the protocol and has to be set when reply packet is received.</p>
</div>
  <h5 id="LiteNetLib_Utils_NtpPacket_DestinationTimestamp_seealso">See Also</h5>
  <div class="seealso">
      <div><a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_CorrectionOffset">CorrectionOffset</a></div>
      <div><a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_RoundTripTime">RoundTripTime</a></div>
  </div>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_LeapIndicator_" data-uid="LiteNetLib.Utils.NtpPacket.LeapIndicator*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_LeapIndicator" data-uid="LiteNetLib.Utils.NtpPacket.LeapIndicator">LeapIndicator</h4>
  <div class="markdown level1 summary"><p>Gets the leap second indicator.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public NtpLeapIndicator LeapIndicator { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="LiteNetLib.Utils.NtpLeapIndicator.html">NtpLeapIndicator</a></td>
        <td><p>Leap second warning, if any. Special value
<a class="xref" href="LiteNetLib.Utils.NtpLeapIndicator.html#LiteNetLib_Utils_NtpLeapIndicator_AlarmCondition">AlarmCondition</a> indicates unsynchronized server clock.
Default is <a class="xref" href="LiteNetLib.Utils.NtpLeapIndicator.html#LiteNetLib_Utils_NtpLeapIndicator_NoWarning">NoWarning</a>.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="LiteNetLib_Utils_NtpPacket_LeapIndicator_remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>Only servers fill in this property. Clients can consult this property for possible leap second warning.</p>
</div>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_Mode_" data-uid="LiteNetLib.Utils.NtpPacket.Mode*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_Mode" data-uid="LiteNetLib.Utils.NtpPacket.Mode">Mode</h4>
  <div class="markdown level1 summary"><p>Gets or sets SNTP packet mode, i.e. whether this is client or server packet.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public NtpMode Mode { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="LiteNetLib.Utils.NtpMode.html">NtpMode</a></td>
        <td><p>SNTP packet mode. Default is <a class="xref" href="LiteNetLib.Utils.NtpMode.html#LiteNetLib_Utils_NtpMode_Client">Client</a> in newly created packets.
Server reply should have this property set to <a class="xref" href="LiteNetLib.Utils.NtpMode.html#LiteNetLib_Utils_NtpMode_Server">Server</a>.</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_OriginTimestamp_" data-uid="LiteNetLib.Utils.NtpPacket.OriginTimestamp*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_OriginTimestamp" data-uid="LiteNetLib.Utils.NtpPacket.OriginTimestamp">OriginTimestamp</h4>
  <div class="markdown level1 summary"><p>Gets or sets the time when the client sent its request.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public DateTime? OriginTimestamp { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Nullable</span>&lt;<span class="xref">System.DateTime</span>&gt;</td>
        <td><p>This property is <code>null</code> in request packets.
In reply packets, it is the time when the client sent its request.
Servers copy this value from <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_TransmitTimestamp">TransmitTimestamp</a>
that they find in received request packet.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="LiteNetLib_Utils_NtpPacket_OriginTimestamp_seealso">See Also</h5>
  <div class="seealso">
      <div><a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_CorrectionOffset">CorrectionOffset</a></div>
      <div><a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_RoundTripTime">RoundTripTime</a></div>
  </div>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_Poll_" data-uid="LiteNetLib.Utils.NtpPacket.Poll*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_Poll" data-uid="LiteNetLib.Utils.NtpPacket.Poll">Poll</h4>
  <div class="markdown level1 summary"><p>Gets server&apos;s preferred polling interval.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public int Poll { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Int32</span></td>
        <td><p>Polling interval in log2 seconds, e.g. 4 stands for 16s and 17 means 131,072s.</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_Precision_" data-uid="LiteNetLib.Utils.NtpPacket.Precision*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_Precision" data-uid="LiteNetLib.Utils.NtpPacket.Precision">Precision</h4>
  <div class="markdown level1 summary"><p>Gets the precision of server clock.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public int Precision { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Int32</span></td>
        <td><p>Clock precision in log2 seconds, e.g. -20 for microsecond precision.</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_ReceiveTimestamp_" data-uid="LiteNetLib.Utils.NtpPacket.ReceiveTimestamp*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_ReceiveTimestamp" data-uid="LiteNetLib.Utils.NtpPacket.ReceiveTimestamp">ReceiveTimestamp</h4>
  <div class="markdown level1 summary"><p>Gets or sets the time when the request was received by the server.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public DateTime? ReceiveTimestamp { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Nullable</span>&lt;<span class="xref">System.DateTime</span>&gt;</td>
        <td><p>This property is <code>null</code> in request packets.
In reply packets, it is the time when the server received client request.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="LiteNetLib_Utils_NtpPacket_ReceiveTimestamp_seealso">See Also</h5>
  <div class="seealso">
      <div><a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_CorrectionOffset">CorrectionOffset</a></div>
      <div><a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_RoundTripTime">RoundTripTime</a></div>
  </div>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_ReferenceId_" data-uid="LiteNetLib.Utils.NtpPacket.ReferenceId*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_ReferenceId" data-uid="LiteNetLib.Utils.NtpPacket.ReferenceId">ReferenceId</h4>
  <div class="markdown level1 summary"><p>Gets the ID of the time source used by the server or Kiss-o&apos;-Death code sent by the server.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public uint ReferenceId { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.UInt32</span></td>
        <td><p>
ID of server&apos;s time source or Kiss-o&apos;-Death code.
Purpose of this property depends on value of <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_Stratum">Stratum</a> property.
</p>
<p>
Stratum 1 servers write here one of several special values that describe the kind of hardware clock they use.
</p>
<p>
Stratum 2 and lower servers set this property to IPv4 address of their upstream server.
If upstream server has IPv6 address, the address is hashed, because it doesn&apos;t fit in this property.
</p>
<p>
When server sets <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_Stratum">Stratum</a> to special value 0,
this property contains so called kiss code that instructs the client to stop querying the server.
</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_ReferenceTimestamp_" data-uid="LiteNetLib.Utils.NtpPacket.ReferenceTimestamp*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_ReferenceTimestamp" data-uid="LiteNetLib.Utils.NtpPacket.ReferenceTimestamp">ReferenceTimestamp</h4>
  <div class="markdown level1 summary"><p>Gets or sets the time when the server clock was last set or corrected.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public DateTime? ReferenceTimestamp { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Nullable</span>&lt;<span class="xref">System.DateTime</span>&gt;</td>
        <td><p>Time when the server clock was last set or corrected or <code>null</code> when not specified.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="LiteNetLib_Utils_NtpPacket_ReferenceTimestamp_remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>This Property is usually set only by servers. It usually lags server&apos;s current time by several minutes,
so don&apos;t use this property for time synchronization.</p>
</div>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_RootDelay_" data-uid="LiteNetLib.Utils.NtpPacket.RootDelay*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_RootDelay" data-uid="LiteNetLib.Utils.NtpPacket.RootDelay">RootDelay</h4>
  <div class="markdown level1 summary"><p>Gets the total round-trip delay from the server to the reference clock.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public TimeSpan RootDelay { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.TimeSpan</span></td>
        <td><p>Round-trip delay to the reference clock. Normally a positive value smaller than one second.</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_RootDispersion_" data-uid="LiteNetLib.Utils.NtpPacket.RootDispersion*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_RootDispersion" data-uid="LiteNetLib.Utils.NtpPacket.RootDispersion">RootDispersion</h4>
  <div class="markdown level1 summary"><p>Gets the estimated error in time reported by the server.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public TimeSpan RootDispersion { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.TimeSpan</span></td>
        <td><p>Estimated error in time reported by the server. Normally a positive value smaller than one second.</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_RoundTripTime_" data-uid="LiteNetLib.Utils.NtpPacket.RoundTripTime*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_RoundTripTime" data-uid="LiteNetLib.Utils.NtpPacket.RoundTripTime">RoundTripTime</h4>
  <div class="markdown level1 summary"><p>Gets the round-trip time to the server.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public TimeSpan RoundTripTime { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.TimeSpan</span></td>
        <td><p>Time the request spent traveling to the server plus the time the reply spent traveling back.
This is calculated from timestamps in the packet as <code>(t1 - t0) + (t3 - t2)</code>
where t0 is <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_OriginTimestamp">OriginTimestamp</a>,
t1 is <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_ReceiveTimestamp">ReceiveTimestamp</a>,
t2 is <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_TransmitTimestamp">TransmitTimestamp</a>,
and t3 is <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_DestinationTimestamp">DestinationTimestamp</a>.
This property throws an exception in request packets.</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_Stratum_" data-uid="LiteNetLib.Utils.NtpPacket.Stratum*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_Stratum" data-uid="LiteNetLib.Utils.NtpPacket.Stratum">Stratum</h4>
  <div class="markdown level1 summary"><p>Gets server&apos;s distance from the reference clock.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public int Stratum { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Int32</span></td>
        <td><p>
Distance from the reference clock. This property is set only in server reply packets.
Servers connected directly to reference clock hardware set this property to 1.
Statum number is incremented by 1 on every hop down the NTP server hierarchy.
</p>
<p>
Special value 0 indicates that this packet is a Kiss-o&apos;-Death message
with kiss code stored in <a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_ReferenceId">ReferenceId</a>.
</p>
</td>
      </tr>
    </tbody>
  </table>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_TransmitTimestamp_" data-uid="LiteNetLib.Utils.NtpPacket.TransmitTimestamp*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_TransmitTimestamp" data-uid="LiteNetLib.Utils.NtpPacket.TransmitTimestamp">TransmitTimestamp</h4>
  <div class="markdown level1 summary"><p>Gets or sets the time when the packet was sent.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public DateTime? TransmitTimestamp { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Nullable</span>&lt;<span class="xref">System.DateTime</span>&gt;</td>
        <td><p>Time when the packet was sent. It should never be <code>null</code>.
Default value is <span class="xref">System.DateTime.UtcNow</span>.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="LiteNetLib_Utils_NtpPacket_TransmitTimestamp_remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>This property must be set by both clients and servers.</p>
</div>
  <h5 id="LiteNetLib_Utils_NtpPacket_TransmitTimestamp_seealso">See Also</h5>
  <div class="seealso">
      <div><a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_CorrectionOffset">CorrectionOffset</a></div>
      <div><a class="xref" href="LiteNetLib.Utils.NtpPacket.html#LiteNetLib_Utils_NtpPacket_RoundTripTime">RoundTripTime</a></div>
  </div>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_VersionNumber_" data-uid="LiteNetLib.Utils.NtpPacket.VersionNumber*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_VersionNumber" data-uid="LiteNetLib.Utils.NtpPacket.VersionNumber">VersionNumber</h4>
  <div class="markdown level1 summary"><p>Gets or sets protocol version number.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public int VersionNumber { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Int32</span></td>
        <td><p>SNTP protocol version. Default is 4, which is the latest version at the time of this writing.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="LiteNetLib_Utils_NtpPacket_VersionNumber_remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>In request packets, clients should leave this property at default value 4.
Servers usually reply with the same protocol version.</p>
</div>
  <h3 id="methods">Methods
  </h3>
  
  
  <a id="LiteNetLib_Utils_NtpPacket_FromServerResponse_" data-uid="LiteNetLib.Utils.NtpPacket.FromServerResponse*"></a>
  <h4 id="LiteNetLib_Utils_NtpPacket_FromServerResponse_System_Byte___System_DateTime_" data-uid="LiteNetLib.Utils.NtpPacket.FromServerResponse(System.Byte[],System.DateTime)">FromServerResponse(Byte[], DateTime)</h4>
  <div class="markdown level1 summary"><p>Initializes packet from data received from a server.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static NtpPacket FromServerResponse(byte[] bytes, DateTime destinationTimestamp)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Byte</span>[]</td>
        <td><span class="parametername">bytes</span></td>
        <td><p>Data received from the server.</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.DateTime</span></td>
        <td><span class="parametername">destinationTimestamp</span></td>
        <td><p>Utc time of reception of response SNTP packet on the client.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="LiteNetLib.Utils.NtpPacket.html">NtpPacket</a></td>
        <td></td>
      </tr>
    </tbody>
  </table>
</article>
          </div>
          
          <div class="hidden-sm col-md-2" role="complementary">
            <div class="sideaffix">
              <div class="contribution">
                <ul class="nav">
                </ul>
              </div>
              <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
                <h5>In This Article</h5>
                <div></div>
              </nav>
            </div>
          </div>
        </div>
      </div>
      
      <footer>
        <div class="grad-bottom"></div>
        <div class="footer">
          <div class="container">
            <span class="pull-right">
              <a href="#top">Back to top</a>
            </span>
            
            <span>Generated by <strong>DocFX</strong></span>
          </div>
        </div>
      </footer>
    </div>
    
    <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
    <script type="text/javascript" src="../styles/docfx.js"></script>
    <script type="text/javascript" src="../styles/main.js"></script>
  </body>
</html>
